package two.chapter_2.c2_4;

import edu.princeton.cs.algs4.StdOut;

public class Ex2_4_1 {

    public static void main(String[] args){
        String []input="PRIO*R**I*T*Y***QUE***U*E".split("");

        MaxPriorityQueue<String> pq=new MaxPriorityQueue<>(30);

        for (int i=0;i<input.length;i++){
            if ("*".equals(input[i])){
                StdOut.print(pq.delMax());
            }else {
                pq.insert(input[i]);
            }
        }
    }
}
